home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / textra16.lha / Textra116 / Scripts / SASC_Scripts / CTRLB.textra < prev    next >
Encoding:
Text File  |  1993-12-31  |  1.5 KB  |  50 lines

  1. /* ARexx macro for Textra & SAS/C
  2.  
  3.    'Build File'
  4.  
  5.    Very simple, really.  Simply ask Textra what the current filename is,
  6.    then call SCMSG with the 'build' command.
  7.    
  8.    Modified 30-Dec-1993 by Ron Charlton: use `file.o' as target when
  9.    any makefile exists, otherwise build everything in the directory (I
  10.    cannot convince SCMSG/SMAKE to build only `file.c').
  11. */
  12.  
  13. options results         /* We *want* results! */
  14.  
  15. get file name; fname = result
  16. get file path; fpath = result    /* so we can make it ARexx's current directory */
  17.  
  18. options                 /* We don't care about results anymore... */
  19.  
  20. OldDir = pragma(D,fpath) /* make ARexx's current directory where file is */
  21.  
  22. if (~show('P',SC_SCMSG)) then do
  23.     address command 'run <nil: >nil: SCMSG'
  24.     address command waitforport SC_SCMSG
  25. end
  26.  
  27. address SC_SCMSG       /* Now talk to SCMSG.  Assumes SCMSG is running. */
  28.  
  29. /* If we find any sort of makefile, target is `file.o', otherwise
  30.  * everything in the directory is built.
  31.  */
  32. if (exists('smakefile') | exists('smakefile.smk') | exists('makefile') |
  33.  exists('lmkfile')  | exists('lmkfile.lmk')) then
  34.     do
  35.     /* Found a makefile.
  36.      * Get the name of the file without an extension.
  37.      * (This will break on `file.ExtraExtension.c'.)
  38.      */
  39.     PARSE VAR fname base '.' extension
  40.     /* Fire up the compiler */
  41.     'build "' || base || '.o"'
  42.     end
  43. else
  44.     do
  45.     /* Fire up the compiler */
  46.     'build'    /* NO makefile, so same as running smake in the current dir. */
  47.     end
  48.  
  49. dummy = pragma(D, OldDir) /* put it back */
  50.